package com.msoe.client.panels;

import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.msoe.client.Session;
import com.msoe.client.customwidgets.NavigationMenu;

public class UserHome implements MSOERPanel{

	public static final String DIV_ID = "user_home";

	private Panel userPanel;
	private Session session;

	public UserHome(Session session){

		this.session = session;

		userPanel = new VerticalPanel();
		userPanel.addStyleDependentName("Center");

		NavigationMenu navMenu = new NavigationMenu(this);
		userPanel.add(navMenu);
	}

	public void show(){
		if(session.validate()){
			RootPanel.get().clear();
			RootPanel.get(DIV_ID).add(userPanel);
		}
		else{
			PanelMap.getPanel("Login").show();
		}
	}

	public void hide(){
		userPanel.removeFromParent();
	}
	
	public Session getSession() {
		return session;
	}

}
